package com.mofang.powerdekorhelper.adapter;

import android.content.Context;

import com.mofang.powerdekorhelper.R;
import com.mofang.powerdekorhelper.base.recycleview.BaseRecycleViewAdapter;
import com.mofang.powerdekorhelper.base.recycleview.BaseViewHolder;
import com.mofang.powerdekorhelper.model.OrderDetial;

import java.util.List;

/**
 * Created by luofei on 2017/8/27 0027.
 * 说明：
 */

public class OrderProductListAdapter extends BaseRecycleViewAdapter {

    public OrderProductListAdapter(List<?> data, Context mContext, int layoutId) {
        super(data, mContext, layoutId);
    }

    @Override
    protected <T> void convert(BaseViewHolder holder, T bean, int position) {

        OrderDetial.ProductInfoList product = (OrderDetial.ProductInfoList) bean;

        holder.setText(R.id.order_product_type, product.getProductModel());

        holder.setText(R.id.order_product_price, product.getPrice() + "");

        holder.setText(R.id.order_product_total_price, "¥ " + product.getTotalPrice());

        if (product.getNum() != null) {
            holder.setText(R.id.order_product_num, product.getNum() + "");
        } else {
            holder.setText(R.id.order_product_num, "无");
        }
    }
}
